<link rel="stylesheet" herf="__PUBLIC__/admin/kindeditor-4.1.7/themes/default/default.css" />
<link rel="stylesheet" herf="__PUBLIC__/admin/kindeditor-4.1.7/plugins/code/prettify.css" />
<script charset="utf-8" src="__PUBLIC__/admin/kindeditor-4.1.7/kindeditor.js"></script>
<script charset="utf-8" src="__PUBLIC__/admin/kindeditor-4.1.7/lang/zh_CN.js"></script>
<script charset="utf-8" src="__PUBLIC__/admin/kindeditor-4.1.7/plugins/code/prettify.js"></script>
<style>
	.textarea{width:100%;height:300px;visibility:hidden;resize: none;}
	.fixed-table-container{border: none;}
	.th-inner{text-align: center;}
	.table{border :1px solid #eee;}
</style>
<div class="row">
	<ol class="breadcrumb">
		<li><a href="{:U('Index/index')}"><span class="glyphicon glyphicon-home"></span></a></li>
		<li class="active">案例展示设置</li>
	</ol>
</div><!--/.row-->

<div class="row">
	<div class="col-lg-12">
		<h1 class="page-header">案例展示设置</h1>
	</div>
</div><!--/.row-->

<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default">
			<div class="panel-body">
				<!-- tab查看数据 -->
				<h3>查看案例：</h3>
				<ul class="nav nav-tabs">
					<li <?php if($activeType==1){echo 'class="active"';} ?> ><a href="#tab1" data-toggle="tab">H5网站展示</a></li>
					<li <?php if($activeType==2){echo 'class="active"';} ?> ><a href="#tab2" data-toggle="tab">UI展示</a></li>
					<li <?php if($activeType==3){echo 'class="active"';} ?> ><a href="#tab3" data-toggle="tab">APP开发+设计招聘</a></li>
					<li <?php if($activeType==4){echo 'class="active"';} ?> ><a href="#tab4" data-toggle="tab">Java开发项目展示</a></li>
				</ul>

				<div class="tab-content">
					<div class="tab-pane fade <?php if($activeType==1){echo 'in active';} ?> " id="tab1">
						<table data-toggle="table" data-url="tables/data2.json" class="table table-hover">
						    <thead>
							    <tr>
								    <th>
									    <div class="th-inner ">案例标题</div>
								    </th>
								    <th>
									    <div class="th-inner ">案例简介</div>
								    </th>
								    <th>
									    <div class="th-inner ">日期</div>
								    </th>
								    <th>
									    <div class="th-inner ">图片地址</div>
								    </th>
								    <th>
									    <div class="th-inner ">操作</div>
								    </th>
							    </tr>
						    </thead>
							<tbody>
							<?php foreach($H5Data as $k => $v) { ?>
							<tr style="text-align: center; ">
								<td><?php echo $v['exampletitle']; ?></td>
								<td><?php echo mb_substr($v['examplecontent'],0,80,"UTF-8"); ?> ...</td><!-- 截取字符串以免撑破页面 -->
								<td><?php echo $v['exampledate']; ?></td>
								<td><?php echo $v['imgurl']; ?></td>
								<td><a href="<?php echo U('Company/exampleDel',array('id'=>$v['id'])); ?>">删除</a></td>
							</tr>
							<?php } ?>
							</tbody>
						</table>
					</div>
					<div class="tab-pane fade <?php if($activeType==2){echo 'in active';} ?> " id="tab2">
						<table data-toggle="table" data-url="tables/data2.json" class="table table-hover">
						    <thead>
							    <tr>
								    <th>
									    <div class="th-inner ">案例标题</div>
								    </th>
								    <th>
									    <div class="th-inner ">案例简介</div>
								    </th>
								    <th>
									    <div class="th-inner ">日期</div>
								    </th>
								    <th>
									    <div class="th-inner ">图片地址</div>
								    </th>
								    <th>
									    <div class="th-inner ">操作</div>
								    </th>
							    </tr>
						    </thead>
							<tbody>
							<?php foreach($UiData as $k => $v) { ?>
							<tr style="text-align: center; ">
								<td><?php echo $v['exampletitle']; ?></td>
								<td><?php echo mb_substr($v['examplecontent'],0,80,"UTF-8"); ?> ...</td>
								<td><?php echo $v['exampledate']; ?></td>
								<td><?php echo $v['imgurl']; ?></td>
								<td><a href="<?php echo U('Company/exampleDel',array('id'=>$v['id'])); ?>">删除</a></td>
							</tr>
							<?php } ?>
							</tbody>
						</table>
					</div>
					<div class="tab-pane fade <?php if($activeType==3){echo 'in active';} ?> " id="tab3">
						<table data-toggle="table" data-url="tables/data2.json" class="table table-hover">
						    <thead>
							    <tr>
								    <th>
									    <div class="th-inner ">案例标题</div>
								    </th>
								    <th>
									    <div class="th-inner ">案例简介</div>
								    </th>
								    <th>
									    <div class="th-inner ">日期</div>
								    </th>
								    <th>
									    <div class="th-inner ">图片地址</div>
								    </th>
								    <th>
									    <div class="th-inner ">操作</div>
								    </th>
							    </tr>
						    </thead>
							<tbody>
							<?php foreach($AppData as $k => $v) { ?>
							<tr style="text-align: center; ">
								<td><?php echo $v['exampletitle']; ?></td>
								<td><?php echo mb_substr($v['examplecontent'],0,80,"UTF-8"); ?> ...</td>
								<td><?php echo $v['exampledate']; ?></td>
								<td><?php echo $v['imgurl']; ?></td>
								<td><a href="<?php echo U('Company/exampleDel',array('id'=>$v['id'])); ?>">删除</a></td>
							</tr>
							<?php } ?>
							</tbody>
						</table>
					</div>
					<div class="tab-pane fade <?php if($activeType==4){echo 'in active';} ?> " id="tab4">
						<table data-toggle="table" data-url="tables/data2.json" class="table table-hover">
						    <thead>
							    <tr>
								    <th>
									    <div class="th-inner ">案例标题</div>
								    </th>
								    <th>
									    <div class="th-inner ">案例简介</div>
								    </th>
								    <th>
									    <div class="th-inner ">日期</div>
								    </th>
								    <th>
									    <div class="th-inner ">图片地址</div>
								    </th>
								    <th>
									    <div class="th-inner ">操作</div>
								    </th>
							    </tr>
						    </thead>
							<tbody>
							<?php foreach($JavaData as $k => $v) { ?>
							<tr style="text-align: center; ">
								<td><?php echo $v['exampletitle']; ?></td>
								<td><?php echo mb_substr($v['examplecontent'],0,80,"UTF-8"); ?> ...</td>
								<td><?php echo $v['exampledate']; ?></td>
								<td><?php echo $v['imgurl']; ?></td>
								<td><a href="<?php echo U('Company/exampleDel',array('id'=>$v['id'])); ?>">删除</a></td>
							</tr>
							<?php } ?>
							</tbody>
						</table>
					</div>
				</div>
				<!-- form数据上传 -->
				<h3>添加案例：</h3>
				<form class="text-center" method="post" action="{:U('Company/exampleSet')}" enctype="multipart/form-data">
				 	<div class="form-group  text-left">
						<label>案例类型选择</label>
						<select class="form-control" name="type">
							<option value="1" <?php if($activeType==1){echo 'selected="selected"';} ?> >H5网站展示</option>
							<option value="2" <?php if($activeType==2){echo 'selected="selected"';} ?> >UI展示</option>
							<option value="3" <?php if($activeType==3){echo 'selected="selected"';} ?> >APP开发+设计招聘</option>
							<option value="4" <?php if($activeType==4){echo 'selected="selected"';} ?> >Java开发项目展示</option>
						</select>
					</div>
				 	<div class="form-group text-left">
	                    <label>案例标题</label>
	                    <input class="form-control" placeholder="请填写新闻标题" name="exampleTitle">
	                </div>
					<div class="form-group text-left">
						<label>案例简介</label>
						<textarea class="textarea" name="exampleContent" >新闻内容</textarea>
						<br/>
					</div>
					<div class="form-group text-left">
						<label>图片上传</label>
						<input type="file" name="imgurl">
						<p class="help-block">请上传图片,小于2M</p>
					</div>
	                <input type="submit" value="提交内容"  class="btn btn-primary" />
				</form>
			</div>
		</div>
	</div><!-- /.col-->
</div><!-- /.row -->

<script>
	KindEditor.ready(function(K) {
		var editor1 = K.create('textarea[name="exampleContent"]', {
			cssPath : '__PUBLIC__/admin/kindeditor-4.1.7/plugins/code/prettify.css',
			allowFileManager : true,
			afterCreate : function() {
				var self = this;
				K.ctrl(document, 13, function() {
					self.sync();
					K('form[name=example]')[0].submit();
				});
				K.ctrl(self.edit.doc, 13, function() {
					self.sync();
					K('form[name=example]')[0].submit();
				});
			}
		});
		prettyPrint();
	});
</script>